package com.jcl.recruit.console.api.register;

import com.jcl.recruit.console.registerService.RegisterService;
import com.jcl.recruit.console.user.model.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName RegisterController
 * @Author yyliu
 * @Date 2018/12/20 9:35
 * @Version 1.0
 **/
@CrossOrigin
@RestController
@RequestMapping(value = "/auth", produces = "text/html;charset=UTF-8")
public class RegisterController {

    @Autowired
    private RegisterService registerService;

    /**
     * 用户注册
     *
     * @param user 用户信息
     * @return 操作结果
     * @throws AuthenticationException 错误信息
     */
    @PostMapping(value = "/register")
    public String register(@RequestBody SysUser user) throws AuthenticationException {
        return registerService.register(user);
    }
}
